package com.token.sysflow.exception;

/**
 * 流程错误
 * @author chenjianxiong 2020/4/12
 */
public class FlowException extends Exception {
    String errorMsg;
    int errCode;
    public FlowException(ErrorCodeEnum code){
        errorMsg = code.getDesc();
        errCode = code.getCode();
    }

    public FlowException(ErrorCodeEnum code,String msg){
        errorMsg = msg + " " + code.getDesc();
        errCode = code.getCode();
    }

    /**
     *
     * @return
     */
    public int getErrCode(){
        return errCode;
    }

    @Override
    public String getMessage() {
        return "[" + errCode + "]" + errorMsg;
    }
    @Override
    public void printStackTrace() {
        System.out.println(errorMsg);
        super.printStackTrace();
    }
}
